package com.study.aoki.reactive.service

import com.study.aoki.reactive.bean.model.User
import com.study.aoki.reactive.repository.UserRepository
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import reactor.core.publisher.Mono

/**
 * @author jiahan.zhou
 * @date 2020/11/24
 */
@Service
class UserService(val userRepository: UserRepository) {

    @Transactional(rollbackFor = [Exception::class])
    fun save(user: User): Mono<User> {
        return userRepository.save(user)
    }
}